use warnings;
use Test::More 'no_plan';
use Inline C;

# test mac_assoc_req
$addr_mode = 2;
$addr_value = 0x5555;
$pan_id = 0x56;
$cap_info = 0x47;
is(assoc_req_cmp_t($addr_mode, $addr_value, $pan_id, $cap_info), 0, 'test mac_assoc_req()');
$addr_mode = 3;
$addr_value = 0x4444;
$pan_id = 0x57;
$cap_info = 0x48;
is(assoc_req_cmp_t($addr_mode, $addr_value, $pan_id, $cap_info), 0, 'test mac_assoc_req()');
$addr_mode = 3;
$addr_value = 0x3333;
$pan_id = 0x59;
$cap_info = 0x48;
is(assoc_req_cmp_t($addr_mode, $addr_value, $pan_id, $cap_info), 0, 'test mac_assoc_req()');
$addr_mode = 4;
$addr_value = 0x3333;
$pan_id = 0x59;
$cap_info = 0x48;
isnt(assoc_req_cmp_t($addr_mode, $addr_value, $pan_id, $cap_info), 0, 'test mac_assoc_req(), the result should be wrong.');

# test mac_asso_resp()
$handle = 0;
$dest_addr = 0x3333;
$short_addr = 0x46;
$status = 0;
is(assoc_resp_cmp_t($handle, $dest_addr, $short_addr, $status), 0, 'test mac_assoc_resp()');

$handle = 0;
$dest_addr = 0x3334;
$short_addr = 0x47;
$status = 0;
is(assoc_resp_cmp_t($handle, $dest_addr, $short_addr, $status), 0, 'test mac_assoc_resp()');

$handle = 0;
$dest_addr = 0x3335;
$short_addr = 0x48;
$status = 0;
is(assoc_resp_cmp_t($handle, $dest_addr, $short_addr, $status), 0, 'test mac_assoc_resp()');

$handle = 0;
$dest_addr = 0x3337;
$short_addr = 0x49;
$status = 0;
is(assoc_resp_cmp_t($handle, $dest_addr, $short_addr, $status), 0, 'test mac_assoc_resp()');

$handle = 0;
$dest_addr = 0x3338;
$short_addr = 0x50;
$status = 0;
is(assoc_resp_cmp_t($handle, $dest_addr, $short_addr, $status), 0, 'test mac_assoc_resp()');

# test mac_assoc_resp


__END__
__C__

#include "../../../../mac/common.h"
#include "../../../../mac/mac_assoc.h"
#include "../../../../mac/mac_tx.h"
#include "../../../../mac/mac_gen.h"
#include "../../../../mac/mac_phy.h"
#include "../../../../mac/mac_info.h"
#include "../../../../mac/mac.h"

#include "mac_assoc_test.c"
#include "../../../../mac/mac_assoc.c"
#include "../../../../mac/mac_tx.c"
#include "../../../../mac/mac_gen.c"
#include "../../stub/mac_rf_stub.c"
#include "../../../../mac/mac_info.c"
#include "../../../../mac/mac_parse.c"
#include "../../../../mac/mac_retry.c"
#include "../../../../mac/mac_indir.c"
#include "../../../../mac/mem.c"
#include "../../../../mac/list.c"
#include "../../../../mac/buf.c"
#include "../../stub/timer_stub.c"
#include "../../../../mac/mac_phy.c"

int assoc_req_cmp_t(unsigned char addr_mode, unsigned int addr_value, unsigned short pan_id,
                    unsigned char cap_info)
{
    mac_assoc_req_t req;

    mac_init_test();

    req.logic_chnl = 0;
    req.chnl_page = 0;
    req.coord_pan_id = pan_id;
    req.coord.mode = addr_mode;
    req.handle = 0;
    if (addr_mode == ADDR_64_M) {
        req.coord.a.addr64 = addr_value;
    } else {
        req.coord.a.addr16 = addr_value;
    }
    req.cap_info = cap_info;

    return mac_assoc_req_cmp(&req);
}

int assoc_resp_cmp_t(unsigned short handle, unsigned int dest_addr,
                         unsigned short short_addr, unsigned char status)
{
/*
typedef struct mac_assoc_resp_t_ {
    uint8 handle;
    int64 dest_addr;
    int16 short_addr;
    mac_status_t status;
} mac_assoc_resp_t;
*/
    mac_assoc_resp_t resp;

    mac_init_test();

    resp.handle = handle;
    resp.dest_addr = dest_addr;
    resp.short_addr = short_addr;
    resp.status = status;
    
    return mac_assoc_resp_test(&resp);
}

